package com.freight.order.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.freight.core.common.utils.PageUtil;
import com.freight.core.common.utils.ResultUtil;
import com.freight.core.common.vo.PageVo;
import com.freight.core.common.vo.Result;
import com.freight.order.dto.DriverGoodsDto;
import com.freight.order.service.DiverHistoricalRecordsService;
import com.freight.order.vo.DriverGoodsVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RestController
@Api(description = "司机端 --- 司机找货接口")
@RequestMapping("/freight/diverHistoricalRecords")
@Transactional
public class DiverHistoricalRecordsController {

    @Autowired
    private DiverHistoricalRecordsService diverHistoricalRecordsService;

    @RequestMapping(value = "/getHistoricalRecords", method = RequestMethod.POST)
    @ApiOperation(value = "司机找货接口")
    public Result<Page<DriverGoodsVo>> getHistoricalRecords(PageVo page, DriverGoodsDto driverGoodsDto) {
        Page<DriverGoodsVo> data  = diverHistoricalRecordsService.getHistoricalRecords(PageUtil.initMpPage(page),driverGoodsDto);
        return new ResultUtil<Page<DriverGoodsVo>>().setData(data);
    }


}
